package com.mendmix.tutorial.api;

import com.mendmix.common.annotation.ApiMetadata;
import com.mendmix.common.constants.PermissionLevel;
import com.mendmix.tutorial.domain.Actor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping(path = "/v1/handler/actor")
public interface ActorApi {

    @ResponseBody
    @ApiMetadata(permissionLevel = PermissionLevel.Anonymous)
    @GetMapping(path = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
    List<Actor> listActors();

    @GetMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE)
    Actor getActor(@RequestParam(name = "actorId") Integer actorId);

    @DeleteMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE)
    boolean deleteActor(@RequestParam(name = "actorId") Integer actorId);

    @PostMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE)
    Actor addActor(@RequestParam(name = "firstName") String firstName, @RequestParam(name = "lastName") String lastName);
}
